import request from '@/utils/request'

export function addUser(data, showLoading=true) {
  return request({
    url: `/travel/user/addUser`,
    method: 'POST',
    headers: {
      'Content-Type': 'multipart/form-data'
    },
    showLoading,
    data
  })
}

export function login(data, showLoading=true) {
  return request({
    url: `/travel/user/login`,
    method: 'POST',
    headers: {
      'Content-Type': 'multipart/form-data',
      'Access-Control-Allow-Origin':'*',
      'Access-Control-Allow-Credentials':'true',
    },
    withCredentials : true,
    showLoading,
    data
  })
}

// 修改密码travel/user/updatePassword
export function updatePassword(data, showLoading=true) {
  return request({
    url: `/travel/user/updatePassword`,
    method: 'POST',
    headers: {
      'Content-Type': 'multipart/form-data'
    },
    showLoading,
    data
  })
}

// 申请vip
export function approveVip(data, showLoading=true) {
  return request({
    url: `/travel/vip/approveVip`,
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    showLoading,
    data
  })
}
